﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UIT_CV_Management
{
    public partial class SettingsForm : Form
    {
        Settings setting = new Settings();

        public SettingsForm()
        {
            InitializeComponent();
            InitLanguage();

            if (setting.Language == "English")
                cbxLanguage.SelectedIndex = 0;
            else
                cbxLanguage.SelectedIndex = 1;
        }

        private void InitLanguage()
        {
            this.Text = Language._("SETTINGS_FORM_TITLE");
            this.lblTitle.Text = Language._("SETTINGS_FORM_TITLE_LBL");
            this.lblLanguage.Text = Language._("SETTINGS_FORM_LANGUAGE_LBL");

            this.cbxLanguage.Items.Clear();
            this.cbxLanguage.Items.Add(Language._("SETTINGS_FORM_LANGUAGE_ENGLISH_ITM"));
            this.cbxLanguage.Items.Add(Language._("SETTINGS_FORM_LANGUAGE_VIETNAMESE_ITM"));

            this.btnBack.Text = Language._("SETTINGS_FORM_BACK_BTN");
            this.btnSave.Text = Language._("SETTINGS_FORM_SAVE_BTN");
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            setting.Save();
        }

        private void cbxLanguage_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbxLanguage.SelectedItem != null)
                if (cbxLanguage.SelectedIndex == 0)
                    setting.Language = "English";
                else
                    setting.Language = "Vietnamese";
        }
    }
}
